

resource pg_query ([ resource $connection ], string $query )



<?php

$conn = pg_pconnect("dbname=publisher");
if (!$conn) {
	echo "An error occurred.\n";
	exit;
}

$result = pg_query($conn, "SELECT author, email FROM authors");
if (!$result) {
	echo "An error occurred.\n";
	exit;
}
?>



<?php

$conn = pg_pconnect("dbname=publisher");

// Estas sentencias se ejecutarán como una transacción.

$query = "UPDATE authors SET author=UPPER(author) WHERE id=1;";
$query .= "UPDATE authors SET author=LOWER(author) WHERE id=2;";
$query .= "UPDATE authors SET author=NULL WHERE id=3;";

pg_query($conn, $query);

?>